package org.learn;

import org.learn.filter.TestFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@ServletComponentScan
public class SpringBootLearnApplication {

/*    //入口类注册Filter
    @Bean //将方法中返回的对象注入到IOC容器中
    public FilterRegistrationBean filterRegiste(){
        FilterRegistrationBean reFilter = new FilterRegistrationBean();
        reFilter.setFilter(new TestFilter()); //创建并注册TestFilter
        reFilter.addUrlPatterns("/*"); //拦截的路径（对所有请求拦截）
        reFilter.setName("TestFilter"); //拦截器的名称
        reFilter.setOrder(1); //拦截器的执行顺序。数字越小越先执行
        return  reFilter;

    }*/

    public static void main(String[] args) {
        SpringApplication.run(SpringBootLearnApplication.class, args);
    }

}
